package controllers

import (
	"github.com/goravel/framework/contracts/http"
	httpfacade "github.com/hulutech-web/http_result"
	"goravel/app/services/server_monitor"
)

type MonitorController struct {
	//Dependent services
	server_monitor.ServerMonitorService
}

func NewMonitorController() *MonitorController {
	return &MonitorController{
		//Inject services
	}
}

// Index returns the monitor list.
// @Summary Get server monitor
// @Description 服务监控.
// @Tags MonitorController
// @Security BearerAuth
// @Accept json
// @Produce json
// @Id MonitorIndex
// @Param Authorization header string true "Bearer token"
// @Success 200 {object} common.SuccessResponse "Successfully retrieved Menus ."
// @Failure 500 {object} common.ErrorResponse "Internal server error."
// @OperationID MonitorIndex
// @Router /api/admin/monitor [get]
func (r *MonitorController) Index(ctx http.Context) http.Response {
	return httpfacade.NewResult(ctx).Success("", r.GetServerMonitorData())
}
